package com.abigdreamer.im.client.module.talk.cinema;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Frame;
import java.awt.Panel;
import javax.media.Player;
import javax.media.rtp.ReceiveStream;

public class PlayerFrame extends Panel {
	//播放器
    Player player;
    //接收数据流对象
    ReceiveStream stream;       
    public  PlayerFrame(Player player, ReceiveStream strm) {
      this.player = player;
      this.stream = strm;
    }
    //  初始化
    public void initialize() {
    	this.setSize(150, 170);
    	PlayerPanel playerPanel=new PlayerPanel(player);
        add(playerPanel);
    }
   //  如果增加了组件，需要整窗口大小
    public void addNotify() {
      super.addNotify();                        
    }

    // 播放器组件类
    class PlayerPanel extends Panel {
      Component visualCom, ctrlCom;
      PlayerPanel(Player p) {
        setLayout(new BorderLayout());
        if ((visualCom = p.getVisualComponent()) != null){
        	visualCom.setSize(150, 150);
          add(visualCom,BorderLayout.CENTER);    
        }
        if ((ctrlCom = p.getControlPanelComponent()) != null){
        	ctrlCom.setSize(150, 20);
          add(ctrlCom,BorderLayout.NORTH); 
        }
      }
    }
  }

